package org.xq.shop.maxaishop.util;

import java.util.HashMap;
import java.util.Map;

public class JsonRes {

    public static Map success(Object data) {
        return success(data, 200);
    }
    public static Map success(Object data, int code) {
        return json(data, code, "操作成功！");
    }
    public static Map failure(Object data) {
        return failure(data, 100);
    }
    public static Map failure(Object data,int code) {
        return json(data, code, "操作失败！");
    }


    /**
     * 返回成功数据信息<
     * @return
     */
    public static Map json(Object data, int code, String message) {
        Map result = new HashMap();
        result.put("data", data);
        result.put("code", code);
        result.put("msg", message);
        return result;
    }

}
